# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>

_realname=pikchr
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.0
_pkgsha=545b29bf49
pkgrel=1
pkgdesc="A PIC-like markup language for diagrams in technical documentation (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://pikchr.org/"
license=('BSD')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
options=('!strip' 'staticlibs' '!buildflags')
source=("${_realname}-${_pkgsha}.tar.gz::${url}/home/tarball/${_pkgsha}/${_realname}-${_pkgsha}.tar.gz"
        'LICENSE')
sha256sums=('6cdb2a98cd7aa458628746bed5e87b5c51214dc56cccd97fa391004f95ef9cc9'
            'bb87a8beb7b525149c69a23029a6957d6d7a72751214fac7a1e4a628ac5cd555')

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  cp -r "${srcdir}/${_realname}-${_pkgsha}" "${srcdir}/build-${MINGW_CHOST}"

  cd "${srcdir}/build-${MINGW_CHOST}"

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"

  mkdir -p "${pkgdir}${MINGW_PREFIX}/bin"
  cp pikchr.exe "${pkgdir}${MINGW_PREFIX}/bin/"

  install -Dm644 "${srcdir}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}

# vim:set ts=2 sw=2 et:
